import { jsx as _jsx } from "react/jsx-runtime";
import { Input } from 'antd';
import { debounce, isFunction } from 'lodash';
import { useState } from 'react';
const debounceFunc = debounce((func) => {
    isFunction(func) && func();
}, 1000);
const SearchInput = (props) => {
    const { className, placeholder, onChange, onPressEnter, ...otherProps } = props;
    const [selfValue, setSelfValue] = useState(undefined);
    const onChangeSearch = (e) => {
        e.persist();
        setSelfValue(e.target.value);
        debounceFunc(() => {
            isFunction(onChange) && onChange(e.target.value);
            // isFunction(onPressEnter) && onPressEnter(e.target.value)
        });
    };
    return (_jsx(Input, { placeholder: placeholder || '请输入搜索关键字', value: selfValue, onChange: onChangeSearch, onPressEnter: onPressEnter, ...otherProps }));
};
export default SearchInput;
